3.8 \(\int x \cot ^2(a+b x) \, dx\)

Optimal. Leaf size=31 \[ \frac {\log (\sin (a+b x))}{b^2}-\frac {x \cot (a+b x)}{b}-\frac {x^2}{2} \]

[Out]

-1/2*x^2-x*cot(b*x+a)/b+ln(sin(b*x+a))/b^2

________________________________________________________________________________________

Rubi [A]  time = 0.02, antiderivative size = 31, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {3720, 3475, 30} \[ \frac {\log (\sin (a+b x))}{b^2}-\frac {x \cot (a+b x)}{b}-\frac {x^2}{2} \]

Antiderivative was successfully verified.

[In]

Int[x*Cot[a + b*x]^2,x]

[Out]

-x^2/2 - (x*Cot[a + b*x])/b + Log[Sin[a + b*x]]/b^2

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3720

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(c + d*x)^m*(b*Tan[e
 + f*x])^(n - 1))/(f*(n - 1)), x] + (-Dist[(b*d*m)/(f*(n - 1)), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rubi steps

\begin {align*} \int x \cot ^2(a+b x) \, dx &=-\frac {x \cot (a+b x)}{b}+\frac {\int \cot (a+b x) \, dx}{b}-\int x \, dx\\ &=-\frac {x^2}{2}-\frac {x \cot (a+b x)}{b}+\frac {\log (\sin (a+b x))}{b^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.22, size = 44, normalized size = 1.42 \[ \frac {\log (\sin (a+b x))}{b^2}-\frac {x \cot (a)}{b}+\frac {x \csc (a) \sin (b x) \csc (a+b x)}{b}-\frac {x^2}{2} \]

Antiderivative was successfully verified.

[In]

Integrate[x*Cot[a + b*x]^2,x]

[Out]

-1/2*x^2 - (x*Cot[a])/b + Log[Sin[a + b*x]]/b^2 + (x*Csc[a]*Csc[a + b*x]*Sin[b*x])/b

________________________________________________________________________________________

fricas [B]  time = 0.74, size = 75, normalized size = 2.42 \[ -\frac {b^{2} x^{2} \sin \left (2 \, b x + 2 \, a\right ) + 2 \, b x \cos \left (2 \, b x + 2 \, a\right ) + 2 \, b x - \log \left (-\frac {1}{2} \, \cos \left (2 \, b x + 2 \, a\right ) + \frac {1}{2}\right ) \sin \left (2 \, b x + 2 \, a\right )}{2 \, b^{2} \sin \left (2 \, b x + 2 \, a\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cot(b*x+a)^2,x, algorithm="fricas")

[Out]

-1/2*(b^2*x^2*sin(2*b*x + 2*a) + 2*b*x*cos(2*b*x + 2*a) + 2*b*x - log(-1/2*cos(2*b*x + 2*a) + 1/2)*sin(2*b*x +
 2*a))/(b^2*sin(2*b*x + 2*a))

________________________________________________________________________________________

giac [B]  time = 4.74, size = 1250, normalized size = 40.32 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cot(b*x+a)^2,x, algorithm="giac")

[Out]

-1/2*(b^2*x^2*tan(1/2*b*x)^2*tan(1/2*a) + b^2*x^2*tan(1/2*b*x)*tan(1/2*a)^2 - b*x*tan(1/2*b*x)^2*tan(1/2*a)^2
- b^2*x^2*tan(1/2*b*x) - b^2*x^2*tan(1/2*a) + b*x*tan(1/2*b*x)^2 + 4*b*x*tan(1/2*b*x)*tan(1/2*a) - log(16*(tan
(1/2*b*x)^8*tan(1/2*a)^2 + 2*tan(1/2*b*x)^7*t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*x)*tan(1/2*a)^3 + tan(1/2*b*x)^2 + 2*tan(1/
2*b*x)*tan(1/2*a) + tan(1/2*a)^2)/(tan(1/2*a)^4 + 2*tan(1/2*a)^2 + 1))*tan(1/2*a))/(b^2*tan(1/2*b*x)^2*tan(1/2
*a) + b^2*tan(1/2*b*x)*tan(1/2*a)^2 - b^2*tan(1/2*b*x) - b^2*tan(1/2*a))

________________________________________________________________________________________

maple [A]  time = 0.72, size = 30, normalized size = 0.97 \[ -\frac {x^{2}}{2}-\frac {x \cot \left (b x +a \right )}{b}+\frac {\ln \left (\sin \left (b x +a \right )\right )}{b^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*cot(b*x+a)^2,x)

[Out]

-1/2*x^2-x*cot(b*x+a)/b+ln(sin(b*x+a))/b^2

________________________________________________________________________________________

maxima [B]  time = 0.47, size = 269, normalized size = 8.68 \[ \frac {2 \, {\left (b x + a + \frac {1}{\tan \left (b x + a\right )}\right )} a - \frac {{\left (b x + a\right )}^{2} \cos \left (2 \, b x + 2 \, a\right )^{2} + {\left (b x + a\right )}^{2} \sin \left (2 \, b x + 2 \, a\right )^{2} - 2 \, {\left (b x + a\right )}^{2} \cos \left (2 \, b x + 2 \, a\right ) + {\left (b x + a\right )}^{2} - {\left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} - 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} + 2 \, \cos \left (b x + a\right ) + 1\right ) - {\left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} - 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} - 2 \, \cos \left (b x + a\right ) + 1\right ) + 4 \, {\left (b x + a\right )} \sin \left (2 \, b x + 2 \, a\right )}{\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} - 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1}}{2 \, b^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cot(b*x+a)^2,x, algorithm="maxima")

[Out]

1/2*(2*(b*x + a + 1/tan(b*x + a))*a - ((b*x + a)^2*cos(2*b*x + 2*a)^2 + (b*x + a)^2*sin(2*b*x + 2*a)^2 - 2*(b*
x + a)^2*cos(2*b*x + 2*a) + (b*x + a)^2 - (cos(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 - 2*cos(2*b*x + 2*a) + 1)*l
og(cos(b*x + a)^2 + sin(b*x + a)^2 + 2*cos(b*x + a) + 1) - (cos(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 - 2*cos(2*
b*x + 2*a) + 1)*log(cos(b*x + a)^2 + sin(b*x + a)^2 - 2*cos(b*x + a) + 1) + 4*(b*x + a)*sin(2*b*x + 2*a))/(cos
(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 - 2*cos(2*b*x + 2*a) + 1))/b^2

________________________________________________________________________________________

mupad [B]  time = 0.45, size = 54, normalized size = 1.74 \[ \frac {\ln \left ({\mathrm {e}}^{a\,2{}\mathrm {i}}\,{\mathrm {e}}^{b\,x\,2{}\mathrm {i}}-1\right )}{b^2}-\frac {x\,2{}\mathrm {i}}{b}-\frac {x^2}{2}-\frac {x\,2{}\mathrm {i}}{b\,\left ({\mathrm {e}}^{a\,2{}\mathrm {i}+b\,x\,2{}\mathrm {i}}-1\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*cot(a + b*x)^2,x)

[Out]

log(exp(a*2i)*exp(b*x*2i) - 1)/b^2 - (x*2i)/b - x^2/2 - (x*2i)/(b*(exp(a*2i + b*x*2i) - 1))

________________________________________________________________________________________

sympy [A]  time = 0.46, size = 68, normalized size = 2.19 \[ \begin {cases} \tilde {\infty } x^{2} & \text {for}\: \left (a = 0 \vee a = - b x\right ) \wedge \left (a = - b x \vee b = 0\right ) \\\frac {x^{2} \cot ^{2}{\relax (a )}}{2} & \text {for}\: b = 0 \\- \frac {x^{2}}{2} - \frac {x}{b \tan {\left (a + b x \right )}} - \frac {\log {\left (\tan ^{2}{\left (a + b x \right )} + 1 \right )}}{2 b^{2}} + \frac {\log {\left (\tan {\left (a + b x \right )} \right )}}{b^{2}} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cot(b*x+a)**2,x)

[Out]

Piecewise((zoo*x**2, (Eq(a, 0) | Eq(a, -b*x)) & (Eq(b, 0) | Eq(a, -b*x))), (x**2*cot(a)**2/2, Eq(b, 0)), (-x**
2/2 - x/(b*tan(a + b*x)) - log(tan(a + b*x)**2 + 1)/(2*b**2) + log(tan(a + b*x))/b**2, True))

________________________________________________________________________________________